<?php
namespace Admin\Model;
use Think\Model\RelationModel;
class ArticleModel extends RelationModel {
	
	//array(验证字段1,验证规则,错误提示,[验证条件,附加规则,验证时间]),
	protected $_validate = array(
		array('title','require','标题不能为空'), //不能为空
		array('title','','已存在该文章','0','unique',2), //不能为空
	);
	
	protected $_link = array(
		'Dept' => array(
		'mapping_type' => self::BELONGS_TO,
		'class_name' => 'Type',
		'foreign_key' => 'typeid',
		'mapping_name' => 'dept',
		'as_fields' => 'typename',
		// 定义更多的关联属性
		),
	);
	
}